package com.fengwk.support.proxy.http;

import org.springframework.beans.factory.FactoryBean;

import com.fengwk.support.util.ReflectUtils;

public class HttpProxyFactory<T> implements FactoryBean<T> {

	private Class<T> interfaceClass;
	
	public Class<T> getInterfaceClass() {
		return interfaceClass;
	}

	public void setInterfaceClass(Class<T> interfaceClass) {
		this.interfaceClass = interfaceClass;
	}
	
	@Override
	public T getObject() throws Exception {
		return ReflectUtils.newProxy(interfaceClass, new HttpProxy());
	}

	@Override
	public Class<?> getObjectType() {
		return interfaceClass;
	}

	// 单例模式
	@Override
	public boolean isSingleton() {
		return true;
	}
	
}
